<template>
	<view>
		<view class="cell">
			<view v-for="(component, index) in components" :key="index">
				<view class="uni-list-cell" style="margin-top: 5%;">
					<view class="uni-list-cell-db">
						<text style="line-height: 100rpx;color: red;">选择上报类型:</text>
						<picker
							style="line-height: 100rpx;color: #BEBEBE;font-size: 32rpx; padding-left: 250px;margin-top: -50px;padding-top: -100px;"
							@change="pick($event,index)" mode='selector' :value="components[index].index"
							:range="components[index].array" disabled class='listPicker'>
							<view>{{ www }}</view>
						</picker>
					</view>
				</view>
			</view>
			<view class="cell-left">
				<view class="cell-text">故障描述：</view>
			</view>
			<view class="cell-left">
				<view class="cell-text">
					<Textarea v-model="contentText" ref="content" style="border: 1px solid #ccc;" pl="请在此处输入故障描述"
						:len='200' disabled></Textarea>
				</view>
			</view>
			<view class="cell-left">
				<view class="cell-text">照片上传：</view>
				<view class="cell-text" style="color: #8C8C8C;width: 180px;">(最多上传3张图片)</view>
			</view>
			<view class="cell-left">
				<view class="qtpicker">
					<!-- 选中待上传的图片 -->
					<view class="preImgs" v-for="(val,index) in preImgUrl" :key='index'>
						<image style="border-radius: 6px;" mode="" :src="val" @click="showImg(val,index)">
						</image>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	// 导入并注册
	import dragButton from "@/components/drag-button/drag-button1.vue";
	export default {
		data() {
			return {
				www: null,
				problemEscalationHistoryList: [],
				item: null,
				contentData: [],
				title: 'Hello',
				radio1: 0,
				preImgUrl: [], //本地预览的图片数据
				components: [],
				imgNum: 0, //一共选中了多少张照片,用来限制本次最大上传数量
				afterUploadPath: null, //上传图片后，返回上传后的图片地址入库用
				isShowAddImgBtn: true,
				content: '',
				fault_id: '',
				contentText: '',
				addoredit: 'add',
				editclick: 0, //是否点击了右上角的编辑按钮
				faultConfirmId: '',
				isShowDelImgBtn: true,
				submitForbide: false,
				radiobakcolor: '',
				completionStatus: null,
				date: new Date().toISOString(),
			}
		},
		onLoad(option) {
			this.item = JSON.parse(option.item)
			// console.log(this.item)
			this.www = this.item.problemtype
			this.contentText = this.item.content
			let imgArr = []
			imgArr = this.item.picturepath.split(',')
			// console.log(imgArr)
			this.preImgUrl = imgArr
		},

		methods: {
			//点击小图查看大图片
			showImg(val, index) {
				// console.log(val, '点击了')
				let that = this
				uni.previewImage({
					// 对选中的图片进行预览
					urls: that.preImgUrl, //图片数组  // urls:['','']  图片的地址 是数组形式
					current: index, //当前图片的下标
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	* {
		box-sizing: border-box;
	}

	.qtpicker {
		width: 100%;
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		margin: 0 auto;
		padding: 10rpx 0;

		.preImgs {
			margin: 13rpx;
			position: relative;

			image {
				width: 200rpx;
				height: 200rpx;
			}

			.cuo {
				width: 17pt;
				height: 17pt;
				//line-height: 12px;
				//text-align: center;
				///* font-size: 16px; */
				//border-radius: 50%;
				//background-color: #223E4B;
				//color: #FFFFFF;
				position: absolute;
				right: 0px;
				top: 0px;
			}
		}


		.addImg {
			width: 200rpx;
			height: 200rpx;
			border: 2rpx solid #d4d4d4;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			font-size: 20rpx;
			background-color: #e2dddd;
			margin-left: 13rpx;
			margin-top: 13rpx;
		}
	}

	.cell {
		height: auto;
		padding-left: 20rpx;
		padding-right: 20rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		align-items: flex-start;
		background: #fff;
		//border-bottom: 1px solid #BDD8F6;

		.cell-left {
			display: flex;
			align-items: center;
			padding: 8px;

			.cell-icon {
				width: 50rpx;
				height: 50rpx;
			}

			.cell-text {
				color: #595959;
				font-size: 15px;
				margin-left: 0rpx;

				//width: 180rpx;
			}
		}

		.iconfont {
			font-size: 40rpx;
			color: #999;
		}
	}

	.radio-content {
		height: 40rpx;
		display: flex;
		align-items: center;
	}

	.radio {
		width: 24rpx;
		height: 24rpx;
		border-radius: 50%;
		border: 1rpx solid #CCCCCC;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		margin: 0rpx 26rpx 0rpx 15rpx;
	}

	.radio-active {
		width: 10rpx;
		height: 10rpx;
		border-radius: 50%;
		background-color: #0079FC;
	}

	.radio-default {
		border: 2rpx solid #0079FC;
	}

	.radio-right {
		margin-left: 36rpx;
	}
</style>